package pl.edu.mimuw.irs.rcp.controller.editor.workflow.menu.builder;

import java.util.List;

import org.eclipse.gef.EditPart;

import pl.edu.mimuw.irs.rcp.controller.editor.workflow.part.IRSArcEditPart;
import pl.edu.mimuw.irs.rcp.controller.editor.workflow.part.IRSNodeEditPart;

/**
 * @author Jakub Rauch
 * Created on: 2009-05-21
 */
public class ContextMenuBuilderFactory {

	// *** Attributes

	// *** Methods
	
	public IContextMenuBuilder getContextMenuBuilder(List<EditPart> selection) {
		IContextMenuBuilder contextMenuBuilder = null;
		if (selection.size() == 1) {
			EditPart editPart = selection.get(0);
			if (editPart instanceof IRSNodeEditPart) {
				contextMenuBuilder = new NodeContextMenuBuilder();
				contextMenuBuilder.setSelection(selection);
			} else if (editPart instanceof IRSArcEditPart) {
				contextMenuBuilder = new ArcContextMenuBuilder();
				contextMenuBuilder.setSelection(selection);
			}
		}
		
		return contextMenuBuilder;
	}
}
